package com.electric.qrapp.net.encrypt;

import java.security.MessageDigest;

/**
 * @Description TODO
 * @Date 2021/8/1 下午1:36
 * @Author heath  <a href="mailto:masker_zero@163.com" target="_blank">masker_zero@163.com</a>
 * @Version
 **/
public class ShaUtil {
    public static byte[] sha1(byte[] data) throws Exception {
        MessageDigest messageDigest = MessageDigest.getInstance("SHA-1");
        return messageDigest.digest(data);
    }

    public static byte[] sha256(byte[] data) throws Exception {
        MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
        return messageDigest.digest(data);
    }

    public static byte[] sha384(byte[] data) throws Exception {
        MessageDigest messageDigest = MessageDigest.getInstance("SHA-384");
        return messageDigest.digest(data);
    }

    public static byte[] sha512(byte[] data) throws Exception {
        MessageDigest messageDigest = MessageDigest.getInstance("SHA-512");
        return messageDigest.digest(data);
    }
}
